package sj.System.dao.impl;

import org.mybatis.spring.SqlSessionTemplate;
import sj.System.dao.storage.StorageRecordMapper;
import sj.System.pojo.StorageRecord;


public class StorageRecordImpl implements StorageRecordMapper {

    /**
     * 第一种方法使用SqlSessionTemplate
     */
    private SqlSessionTemplate sqlSession;
    public SqlSessionTemplate getSqlSession() {
        return sqlSession;
    }

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }

    /**
     * 增加
     *
     * @param storageRecord
     * @return
     */
    @Override
    public int addStorage_record(StorageRecord storageRecord) {
        return sqlSession.update("sj.System.dao.storage.StorageRecordMapper.addStorage_record",storageRecord);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @Override
    public int delStorage_record(Integer id) {
        return sqlSession.update("sj.System.dao.storage.StorageRecordMapper.delStorage_record",id);
    }

    /**
     * 修改
     *
     * @param storageRecord
     * @return
     */
    @Override
    public int updateStorage_record(StorageRecord storageRecord) {
        return sqlSession.update("sj.System.dao.storage.StorageRecordMapper.updateStorage_record",storageRecord);
    }
}
